package wangwenjun.phase2.concurrencypattern.activeobject.staticproxy.framework;

/**
 * @author ChangLiang
 * @date 2020/6/17
 */
class OrderServiceDaemonThread extends Thread{

    private final OrderServiceMessageQueue queue;

    public OrderServiceDaemonThread(OrderServiceMessageQueue queue) {
        super("order-service-daemon-thread");
        this.queue = queue;
        setDaemon(true);
    }

    @Override
    public void run() {
        while (true) {
            OrderServiceMessage message = this.queue.take();
            message.execute();
        }
    }
}
